<?php echo $this->load->view('meta'); ?>
<script type="text/javascript" language="JavaScript">
	$(document).ready(function() {
		$('.entry .entry-body:not(:first)').hide();
		$('.entry .entry-title span a').addClass('show');
		$('.entry .entry-title:first span a').removeClass('show').addClass('hide');
		$('.entry').find('span a').click(function() {
			$(this).parent('span').parent('div').next().slideToggle();
			$(this).toggleClass('show').toggleClass('hide');
			return false;
		});
		$('#expand').click(function() {
			$('.entry').find('.entry-body').slideDown();
			$('.entry').find('span a').removeClass('show').addClass('hide');
			return false;
		});
		$('#collapse').click(function() {
			$('.entry').find('.entry-body').slideUp();
			$('.entry').find('span a').removeClass('hide').addClass('show');
			return false;
		});
	});
</script>
<title>xa-ncsu | blog</title>
<?php echo $this->load->view('header'); ?>
<div id="blog_header">
	<p><a href="#" id="expand">expand all</a> / <a href="#" id="collapse">collapse all</a></p>
	<h1>Chi Alpha blog</h1>
</div>
<?php if ($posts->num_rows() > 0): ?>
<?php foreach ($posts->result() as $post): ?>
<div class="entry">
	<div class="entry-title">
		<span><a href="#"></a></span>
		<h2><?=anchor('blog/post/'.$post->id, $post->title);?></h2>
		<p class="posted"><?=$post->posted?></p>
	</div>
	<div class="entry-body"><?=$post->body?></div>
	<ul class="entry-footer clearfix">
		<li class="author"><?php if (isset($loggedin)): ?><?=anchor('users/profile/'.$post->authorid, $post->author);?><?php else: ?><?=$post->author?><?php endif; ?></li>
		<li class="comments">
		<?php if ($post->num_comments == 0) : ?>
		 	<?=anchor('blog/post/'.$post->id, 'No Comments'); ?>
		 <?php else: ?>
			<?=anchor('blog/post/'.$post->id, 'Comments'); ?>: <?=$post->num_comments?>
		<?php endif; ?>
		</li>
	</ul>
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php echo $this->load->view('footer'); ?>